import Vue from 'vue';
import Vuex from 'vuex';
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex);
const config = {
    plugins: [createPersistedState()],
    state: {
        isLogin: false,
        username: '',
		numInfo:{},//挂号信息
        token: '',
		chooseIndex:0,
		oldCode:'',
		portInfo:{},//信息
		rgst_no:'',
		rgstInfo:{}
    },
    getters: {
        isLogin: state => state.isLogin,
        token: state => state.token,
        username: state => state.username,
		numInfo: state => state.numInfo,
		chooseIndex: state => state.chooseIndex,
		oldCode: state => state.oldCode,
		portInfo: state => state.portInfo,
		rgst_no: state => state.rgst_no,
		rgstInfo: state => state.rgstInfo,
    },
    mutations: {
		updatergstInfo(state, rgstInfo) {
		    state.rgstInfo = rgstInfo;
		},
		updatergst_no(state, payload) {
		    state.rgst_no = payload;
		},
		updateportInfo(state, payload) {
		    state.portInfo = payload;
		},
		updateCode(state, payload) {
		    state.oldCode = payload;
		},
        updateLogin(state, payload) {
            state.isLogin = payload;
        },
        updateToken(state, payload) {
            state.token = payload;
        },
		updateNumInfo(state, payload) {
		    state.numInfo = payload;
		},
		updateChooseIndex(state, payload) {
		    state.chooseIndex = payload;
		},
        updateUsername(state, payload) {
            state.username = payload;
        }
    },
    actions: {}
}
const store = new Vuex.Store(config);
export default store;